package com.ruoyi.wisdom.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wisdom.domain.IotPickTemperatureRecord;
import com.ruoyi.wisdom.service.IIotPickTemperatureRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 实时识别记录Controller
 * 
 * @author ruoyi
 * @date 2025-02-08
 */
@RestController
@RequestMapping("/wisdom/temperaturerecord")
public class IotPickTemperatureRecordController extends BaseController
{
    @Autowired
    private IIotPickTemperatureRecordService iotPickTemperatureRecordService;

    /**
     * 查询实时识别记录列表
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(IotPickTemperatureRecord iotPickTemperatureRecord)
    {
        startPage();
        List<IotPickTemperatureRecord> list = iotPickTemperatureRecordService.selectIotPickTemperatureRecordList(iotPickTemperatureRecord);
        return getDataTable(list);
    }

    /**
     * 导出实时识别记录列表
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:export')")
    @Log(title = "实时识别记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IotPickTemperatureRecord iotPickTemperatureRecord)
    {
        List<IotPickTemperatureRecord> list = iotPickTemperatureRecordService.selectIotPickTemperatureRecordList(iotPickTemperatureRecord);
        ExcelUtil<IotPickTemperatureRecord> util = new ExcelUtil<IotPickTemperatureRecord>(IotPickTemperatureRecord.class);
        util.exportExcel(response, list, "实时识别记录数据");
    }

    /**
     * 获取实时识别记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:query')")
    @GetMapping(value = "/{temperatureId}")
    public AjaxResult getInfo(@PathVariable("temperatureId") Long temperatureId)
    {
        return success(iotPickTemperatureRecordService.selectIotPickTemperatureRecordByTemperatureId(temperatureId));
    }

    /**
     * 新增实时识别记录
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:add')")
    @Log(title = "实时识别记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IotPickTemperatureRecord iotPickTemperatureRecord)
    {
        return toAjax(iotPickTemperatureRecordService.insertIotPickTemperatureRecord(iotPickTemperatureRecord));
    }

    /**
     * 修改实时识别记录
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:edit')")
    @Log(title = "实时识别记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IotPickTemperatureRecord iotPickTemperatureRecord)
    {
        return toAjax(iotPickTemperatureRecordService.updateIotPickTemperatureRecord(iotPickTemperatureRecord));
    }

    /**
     * 删除实时识别记录
     */
    @PreAuthorize("@ss.hasPermi('wisdom:temperaturerecord:remove')")
    @Log(title = "实时识别记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{temperatureIds}")
    public AjaxResult remove(@PathVariable Long[] temperatureIds)
    {
        return toAjax(iotPickTemperatureRecordService.deleteIotPickTemperatureRecordByTemperatureIds(temperatureIds));
    }
}
